<template>
	<view>
		<view class="flex-col homepage">
			<view class="flex-col wrapper">
				<view class="flex-row wraper-row">
					<view class="">
						<view class="u-line-1 text">车位信息</view>
					</view>
				</view>
				<u-line class="line" margin="0rpx 0rpx 26rpx 0rpx"></u-line>
				<view class="flex-row wraper-row-two" style="width:230px;">
					<view class="u-line-1 text-three" style="width:100px;">小区</view>
					<u--input v-model="carinfo.communityName" border="none"></u--input>
				</view>
				<view class="flex-row wraper-row-three" style="width:230px;">
					<view class="u-line-1 text-five" style="width:100px;">停车场</view>
					<u--input v-model="carinfo.communityName" border="none">停车场</u--input>
				</view>
				<view class="flex-row wraper-row-three" style="width:230px;">
					<view class="u-line-1 text-five" style="width:100px;">车位区域</view>
					<u--input v-model="carinfo.area" border="none"></u--input>
				</view>
				<view class="flex-row wraper-row-three" style="width:230px;">
					<view class="u-line-1 text-five" style="width:100px;">车位编号</view>
					<view v-if="carinfo.serialNumber==null">
						<u--input v-model="q2" border="none"></u--input>
					</view>
					<u--input v-model="carinfo.serialNumber" border="none"></u--input>
				</view>
				<view class="flex-row wraper-row-three" style="width:230px;">
					<view class="u-line-1 text-five" style="width:100px;">车位状态</view>
					<view v-if="carinfo.vehicleState==null">
						<u--input v-model="q1" border="none"></u--input>
					</view>
					<u--input v-model="carinfo.vehicleState" border="none"></u--input>
				</view>
			</view>
		</view>
		<view class="flex-col homepage">
			<view class="flex-col wrapper" :model="user">
				<view class="flex-row wraper-row">
					<view class="">
						<view class="u-line-1 text">住户信息</view>
					</view>
				</view>
				<u-line class="line" margin="0rpx 0rpx 26rpx 0rpx"></u-line>
				<view class="flex-row wraper-row-two" style="width:230px;">
					<view class="u-line-1 text-three" style="width:100px;">住户姓名</view>
					<u--input v-model="user.userName" border="none"></u--input>
				</view>
				<view class="flex-row wraper-row-three" style="width:230px;">
					<view class="u-line-1 text-five" style="width:100px;">手机号码</view>
					<u--input v-model="user.phone" border="none"></u--input>
				</view>
			</view>
		</view>
		<view class="flex-col homepage" >
			<view class="flex-col wrapper" v-if="carinfo.vehicleCarId != null">
				<view class="flex-row wraper-row">
					<view class="flex-row wraper-row-two">
						<view class="u-line-1 text" style="float: left; width:250px;">车辆信息</view>
						<view class="u-line-1 text-three" style="float:right; color:blue;" @click="cancleBinding()">取消绑定</view>
					</view>
				</view>
				<u-line class="line" margin="0rpx 0rpx 26rpx 0rpx"></u-line>
				<view class="flex-row wraper-row-two" style="width:230px;">
					<view class="u-line-1 text-three" style="width:100px;">车牌号</view>
					<u--input v-model="carinfo.vehicleNumber" border="none"></u--input>
				</view>
				<view class="flex-row wraper-row-three" style="width:230px;">
					<view class="u-line-1 text-five" style="width:100px;">车辆品牌</view>
					<u--input v-model="carinfo.vehicleBrand" border="none"></u--input>
				</view>
				<view class="flex-row wraper-row-three" style="width:230px;">
					<view class="u-line-1 text-five" style="width:100px;">车辆型号</view>
					<u--input v-model="carinfo.vehicleModel" border="none"></u--input>
				</view>
				<view class="flex-row wraper-row-three" style="width:230px;">
					<view class="u-line-1 text-five" style="width:100px;">车身颜色</view>
					<u--input v-model="carinfo.vehicleColor" border="none"></u--input>
				</view>
			</view>
			<view>
				<view class="flex-row wrapper-two" style="float:left;">
					<view class="u-line-1 text-nine" @click="toUpdateCarportUser(carinfo)">修改</view>
				</view>
				<view class="flex-row wrapper-two1" style="float:right;">
					<view class="u-line-1 text-nine" @click="deleteCarportUser(carinfo.vehicleMiddleId)">删除</view>
				</view>
			</view>
		</view>
			
	</view>
</template>

<script>
	export default {
		data() {
			return {
				user: {},
				carinfo: {},
				q1:'未绑定',
				q2:'无信息'
				
				
			}
		},
		onLoad(e) {
			this.carinfo = JSON.parse(decodeURIComponent(e.item));
			console.log(this.carinfo)
			this.user = uni.getStorageSync('user')
		},
		methods: {
			toUpdateCarportUser(){
				uni.navigateTo({
				    url: '../xss/updateCarportInfo?carinfo=' + encodeURIComponent(JSON.stringify(this.carinfo)),
				    success: function(res) {
				        console.log(res)                
				    }
				})
			},
			
			deleteCarportUser() {
				console.log("carinfo.vehicleMiddleId::::",this.carinfo);
				this.$axios({
					url: 'serverwg/app/car/deleteCarportUser',
					data: {
						vehicleMiddleId: this.carinfo.vehicleMiddleId,
						vehicleCarId: this.carinfo.vehicleCarId,
						vehicleNumberId: this.carinfo.vehicleNumberId
					},
					method: 'GET',
					success: (res) => {
						alert("删除成功!")
						uni.navigateTo({
						    url: '../xss/carport'
						})
					}
				})
			},
			cancleBinding(){
				console.log(this.carinfo);
				this.$axios({
					url: 'serverwg/app/car/updateCancleBinding',
					data: this.carinfo,
					method: 'POST',
					success: (res) => {
						alert("已取消绑定")
						uni.navigateTo({
						    url: '../xss/carport'
						})
					}
				})
			}

		}
	}
</script>

<style lang="scss" scoped>
	/** 全局样式-开始,建议放在公共css样式文件中,比如common.css 或app.vue文件 */

	html,
	body {
		margin: 0;
		width: 100%;
		height: 100%;
		font-size: 16px
	}

	view,
	text,

	image {
		position: relative;
		box-sizing: border-box;
		flex-shrink: 0;
	}

	.flex-col {
		display: flex;
		align-items: flex-start;
		flex-direction: column;
	}

	.flex-row {
		display: flex;
		align-items: flex-start;
	}

	.flex-col .flex-row {
		width: 100%
	}

	/** 全局样式-结束*/

	.homepage {
		padding: 54rpx 0rpx 0rpx 15rpx;
		border-color: #f2f2f2;
		font-size: 32rpx;
		color: 0rpx;

		.wrapper {
			width: 710rpx;
			margin-bottom: 30rpx;
			padding: 23rpx 0rpx 29rpx 40rpx;
			border-width: 2rpx;
			border-style: solid;
			border-size: 2px;
			border-color: rgba(221, 221, 221, 1);
			border-radius: 10rpx;

			.wraper-row {
				width: 568rpx;
				justify-content: space-between;
				margin: 0rpx 0rpx 18rpx 14rpx;

				.box {
					width: 80rpx;
					margin-top: 6rpx;
					border-width: 20rpx;
					border-radius: 10rpx;
					background: #006eff;

					.text {
						width: 62rpx;
						margin-left: 14rpx;
						font-size: 6rpx;
						color: rgba(255, 255, 255, 1);
					}
				}

				.text-two {
					width: 296rpx;
					margin-top: 6rpx;
				}

				.tag {
					border-radius: 6rpx;
					font-size: 6rpx;
					background: #ffe9d7;
					color: #ffa938;
				}
			}

			.line {
				width: 648rpx;
				height: 0rpx;
			}

			.wraper-row-two {
				width: 305rpx;
				justify-content: space-between;
				margin: 0rpx 0rpx 20rpx 6rpx;
				padding-right: 1rpx;

				.text-three {
					width: 104rpx;
					font-size: 4rpx;
					color: #9a9a9a;
				}

				.text-four {
					width: 300rpx;
					font-size: 4rpx;
					color: #000000;
				}
			}

			.wraper-row-three {
				width: 305rpx;
				justify-content: space-between;
				margin: 0rpx 0rpx 20rpx 6rpx;
				padding-right: 1rpx;

				.text-five {
					width: 104rpx;
					font-size: 4rpx;
					color: #9a9a9a;
				}

				.text-six {
					width: 350rpx;
					font-size: 4rpx;
					color: #000000;
				}
			}

			.wraper-row-four {
				width: 305rpx;
				justify-content: space-between;
				margin-left: 6rpx;
				padding-right: 1rpx;

				.text-seven {
					width: 104rpx;
					font-size: 4rpx;
					color: #9a9a9a;
				}

				.text-eight {
					width: 188rpx;
					font-size: 4rpx;
					color: #000000;
				}
			}
		}

		.wrapper-two {
			width: 250rpx;
			justify-content: center;
			margin-left: 66rpx;
			padding: 23rpx 0rpx;
			border-radius: 10rpx;
			background: #006eff;

			.text-nine {
				text-align: center;
				width: 176rpx;
				font-size: 32rpx;
				color: rgba(255, 255, 255, 1);
			}
		}

		.wrapper-two1 {
			width: 250rpx;
			justify-content: center;
			margin-left: 66rpx;
			padding: 23rpx 0rpx;
			border-radius: 10rpx;
			background: #fff;
			border-color: 1px soild rgba(255, 0, 0, 1.0);

			.text-nine {
				text-align: center;
				width: 176rpx;
				font-size: 32rpx;
				color: rgba(255, 0, 0, 1.0);
			}
		}
	}
</style>
